package com.example.taximeter.bean;



import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * 计价器管理
 */
public class Taximeter {

    @NotNull(message = "计价器id格式错误", groups =  GroupUpdate.class)
    private Integer id;//计价器id--主键

    @NotNull(message = "计价器厂家id格式错误", groups = {GroupCreate.class, GroupUpdate.class})
    private Integer factid;//计价器厂家id--外键

    @Valid
    @NotNull(message = "计价器型号id格式错误", groups = {GroupCreate.class, GroupUpdate.class})
    private Integer jjqtypeid;//计价器型号id--外键

    @NotNull(message = "价格类别id格式错误", groups = {GroupCreate.class, GroupUpdate.class})
    private Integer priceid;//价格类别id--外键

    @NotNull(message = "车牌号格式错误", groups = GroupCreate.class)
    @NotEmpty(message = "车牌号不能为空", groups = GroupCreate.class)
    @Pattern(regexp = "^(([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z](([0-9]{5}[DF])|([DF]([A-HJ-NP-Z0-9])[0-9]{4})))|([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z][A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳使领]))$", message = "车牌号格式错误", groups = {GroupCreate.class, GroupUpdate.class})
    private String carno;//车牌号

    @NotNull(message = "出租车公司id格式错误", groups = GroupCreate.class)
    private Integer companyid;//出租车公司id--外键

    @Override
    public String toString() {
        return "Taximeter{" +
                "id=" + id +
                ", factid=" + factid +
                ", jjqtypeid=" + jjqtypeid +
                ", priceid=" + priceid +
                ", carno='" + carno + '\'' +
                ", companyid=" + companyid +
                '}';
    }

    public Taximeter(){}

    public Taximeter(Integer factid, Integer jjqtypeid, Integer priceid, Integer companyid, String carno){
        this.factid = factid;
        this.jjqtypeid = jjqtypeid;
        this.priceid = priceid;
        this.companyid = companyid;
        this.carno = carno;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getFactid() {
        return factid;
    }

    public void setFactid(Integer factid) {
        this.factid = factid;
    }

    public Integer getJjqtypeid() {
        return jjqtypeid;
    }

    public void setJjqtypeid(Integer jjqtypeid) {
        this.jjqtypeid = jjqtypeid;
    }

    public Integer getPriceid() {
        return priceid;
    }

    public void setPriceid(Integer priceid) {
        this.priceid = priceid;
    }

    public String getCarno() {
        return carno;
    }

    public void setCarno(String carno) {
        this.carno = carno;
    }

    public Integer getCompanyid() {
        return companyid;
    }

    public void setCompanyid(Integer companyid) {
        this.companyid = companyid;
    }

}
